


public class LocalVarDecl extends Statement {

	String id;
	Type type;

	public LocalVarDecl(String id, Type type) {
		super();
		this.id = id;
		this.type = type;
	}

	public void check() throws SemanticException {
		SymbolTable table = SymbolTable.getInstance();
		if (table.contains(id))
			throw new SemanticException("Id exists: " + id);
		table.add(new Entry(id, Entry.VARIABLE, type.type));
	}

	public String toString() {
		return "LocalVarDecl " + id + "\n";
	}
}
